package cn.com.fuhuitong.main.access.mode

import cn.com.fuhuitong.http.BaseApiService
import cn.com.fuhuitong.http.BaseResponse
import cn.com.fuhuitong.main.access.entity.AccessResponse
import io.reactivex.Observable
import retrofit2.http.*

interface AccessApi : BaseApiService {

    @FormUrlEncoded
    @POST("/api/user/login")
    fun login(
        @Field("account") account: String,
        @Field("password") password: String
    ): Observable<AccessResponse>

    @FormUrlEncoded
    @POST("/api/user/mobilelogin")
    fun mobileLogin(
        @Field("mobile") mobile: String,
        @Field("captcha") captcha: String
    ): Observable<AccessResponse>

    @FormUrlEncoded
    @POST("/api/user/wx_app_third")
    fun weChatLogin(
        @Field("code") wxCode: String
    ): Observable<AccessResponse>

    @FormUrlEncoded
    @POST("/api/user/bind_mobile")
    fun mobileBind(
        @Header("token") token: String,
        @Field("invitees_mobile") inviteesMobile: String,
        @Field("invitees_name") inviteesName: String,
        @Field("nickname") nickname: String,
        @Field("identity_card") identityCard: String,
        @Field("mobile") mobile: String,
        @Field("captcha") captcha: String
    ): Observable<AccessResponse>

    @FormUrlEncoded
    @POST("/api/user/register")
    fun register(
        @Field("mobile") mobile: String,
        @Field("nickname") nickname: String,
        @Field("password") password: String,
        @Field("code") code: String
    ): Observable<AccessResponse>

    @FormUrlEncoded
    @POST("/api/user/resetpwd")
    fun resetpwd(
        @Field("mobile") mobile: String,
        @Field("newpassword") newpassword: String,
        @Field("captcha") captcha: String
    ): Observable<BaseResponse>

    @GET("/api/sms/send")
    fun sendShortMessage(
        @Query("mobile") mobile: String,
        @Query("event") event: String
    ): Observable<BaseResponse>

}